1. Field of the Invention
Provided are a method, system, and program for caching resources requested by applications.
2. Description of the Related Art
In a computing environment, applications may access external services by instantiating resources, such as objects, that are used to access and perform operations related to the external services. Such resources include session objects, connection objects to provide a connection to the service, and other objects related to the use of the service, such as queues, managers, etc. Resources also include other types of services, functions objects, and links to external data. For example, to access a Java Messaging Service (JMS), the application instantiates a connection and session objects, as well as message queues and message manager objects. (Java is a trademark of Sun Microsystems, Inc.). Similarly, to access a database in a Java computing environment, applications may instantiate a connection and other objects for a Java Database Connectivity (JDBC) service that provides access to external databases.
A cache may be used to store resources instantiated by an application. A developer may create a cache to store a particular type of resource, such that multiple caches are created for the different resources. For instance, a developer may use one cache for identical database connection objects for a JDBC service and another cache for identical session and connection objects for a JMS service. This technique requires different caches for different types of resources. If the applications are instantiating different types of resources that are tightly coupled, then the applications must keep track of how resources in different caches are related, which may be difficult to code. Further, maintaining different caches for the different resource types may result in the allocation of an entire cache to a resource that is not frequently used.
Operating system resources may be stored in one cache, such that distinct resources are mapped to specific locations in a virtual memory page. In this case the cache consists of distinct resources that map to specific locations in the cache.